<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>专业管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			//给专业类别绑定change事件
			$("#disciplineFields").on('change', 'select', function(){
				selectChange(this,'${ctx}/university/majorCategory/listDataBySelecteddisciplineFields','majorCategory','majorCategory.id','专业类别');
			})
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
	</script>
	<script type="text/javascript" src="${ctxStatic}/js/wending/common.js"></script>
	<script type="text/javascript" src="${ctxStatic}/js/wending/linkage.js"></script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/university/major/">专业列表</a></li>
		<shiro:hasPermission name="university:major:edit"><li><a href="${ctx}/university/major/form">专业添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="major" action="${ctx}/university/major/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>学历层次：</label>
				<form:select path="xueLiLevel.id" class="input-xlarge required" onchange="selectChange(this,'${ctx}/university/disciplineFields/listDataBySelectedXueLiLevel','disciplineFields','disciplineFields.id','学科门类')">
					<form:option value="" label=""/>
					<form:options items="${fns:getXueLiLevelList()}" itemLabel="name" itemValue="id" htmlEscape="false"/>
				</form:select>
			</li>
			<li id="disciplineFields">
				<c:if test="${not empty major.xueLiLevel.id && major.xueLiLevel.id != ''}">
					<label>学科门类：</label>
					<form:select path="disciplineFields.id" class="input-xlarge required" onchange="selectChange(this,'${ctx}/university/majorCategory/listDataBySelecteddisciplineFields','majorCategory','majorCategory.id','专业类别')">
						<form:option value="" label=""/>
						<form:options items="${fns:getDisciplineFieldsListByXueLi(major.xueLiLevel.id)}" itemLabel="name" itemValue="id" htmlEscape="false"/>
					</form:select>
				</c:if>
			</li>
			<li id="majorCategory">
				<c:if test="${not empty major.disciplineFields.id}">
					<label>专业类别：</label>
					<form:select path="majorCategory.id" class="input-xlarge required">
						<form:option value="" label=""/>
						<form:options items="${fns:getMajorCategoryListByDfId(major.disciplineFields.id)}" itemLabel="name" itemValue="id" htmlEscape="false"/>
					</form:select>
				</c:if>
			</li>
			<li><label>专业：</label>
				<form:input path="name" htmlEscape="false" maxlength="255" class="input-medium"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>序号</th>
				<th>学历层次</th>
				<th>学科门类</th>
				<th>专业类别</th>
				<th>专业</th>
				<th>特设</th>
				<th>更新时间</th>
				<shiro:hasPermission name="university:major:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="major">
			<tr>
				<td>
					${major.sequence}
				</td>
				<td>
					${major.xueLiLevel.name}
				</td>
				<td>
					${major.disciplineFields.name}
				</td>
				<td>
					${major.majorCategory.name}
				</td>
				<td><a href="${ctx}/university/major/form?id=${major.id}">
					${major.name}
				</a></td>
				<td>
					${fns:getDictLabel(major.adHoc, 'yes_no', '')}
				</td>
				<td>
					<fmt:formatDate value="${major.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<shiro:hasPermission name="university:major:edit"><td>
    				<a href="${ctx}/university/major/form?id=${major.id}">修改</a>
					<a href="${ctx}/university/major/delete?id=${major.id}" onclick="return confirmx('确认要删除该专业吗？', this.href)">删除</a>
				</td></shiro:hasPermission>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>